<?PHP
	require 'config.php';
	require 'modifyImage.php';
	require 'CyrillicEncoder.php';
	
	//connecting to DB
	$vLink = mysql_connect($DBServer, $DBUser, $DBPassword);
	if(!$vLink) 
		die(mysql_error());
	
	//setting session encoding
	mysql_select_db($DBName, $vLink);	
	mysql_query("SET NAMES 'cp1251';", $vLink);
	mysql_query("SET CHARACTER SET 'cp1251';", $vLink);
	mysql_query("SET SESSION collation_connection = 'cp1251_general_ci';", $vLink);
	
	//retrieving params	
	$OwnerID = ReadInt($_GET['owner_id']);	
	$Name = mysql_real_escape_string($_GET['name']);
	
	//sending query
	$vQuery = "INSERT INTO dikar2011_nomer(owner, name, public) VALUES ('$OwnerID', '$Name', '1')";	
	$vResult = mysql_query($vQuery);	
	function ReadInt($Param)
	{
		$vResult = -1;
		if(isset($Param))
		{
			$vResult = intval($Param);
		}
		return $vResult;
	}
	//printing update result for AS side
	$vResult = mysql_insert_id();
	mysql_close($vLink);
	echo $vResult;
?>